/*
 * PreferenceConstants.java
 * 
 * Copyright 2007 Kamen Petroff.
 * All Rights Reserved.
 * 
 * This software is the proprietary information of Kamen Petroff.
 * Use is subject to license terms.
 * 
 * Created on Mar 2, 2007 at 14:13:14 by Kamen Petroff
 */
package com.google.code.shell4eclipse.preferences;

import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

import com.google.code.shell4eclipse.Shell4EclipsePlugin;

/**
 * Constant definitions for plug-in preferences
 *  
 * @author Kamen Petroff
 * @since Mar 3, 2007
 */
public class Preferences {

	public static final String P_EXECUTABLE = "executable";
	
	public static final String P_WORKING_DIRECTORY = "workingDirectory";

	public static final String P_ARGUMENTS = "arguments";
	
//	public static final String P_BOOLEAN = "booleanPreference";
//
//	public static final String P_CHOICE = "choicePreference";
//
//	public static final String P_STRING = "stringPreference";

	

	public static String getExecutable() {
		return Shell4EclipsePlugin.getDefault().getPreferenceStore().getString(P_EXECUTABLE);
	}
	public static List<String> getArguments() {
		List<String> result = new ArrayList<String>();
		String executable = Shell4EclipsePlugin.getDefault().getPreferenceStore().getString(P_ARGUMENTS);
		StringTokenizer tokenizer = new StringTokenizer(executable);
		while(tokenizer.hasMoreElements()) {
			String token = tokenizer.nextToken();
			result.add(token);
		}
		return result;
	}
	public static File getWorkingDirectory() {
		File result = new File(Shell4EclipsePlugin.getDefault().getPreferenceStore().getString(P_WORKING_DIRECTORY));
		if(result.exists() && result.isDirectory()) {
			return result;
		}
		return null;
	}
}
